<template>
  <div class="containers">
    <!-- 数据大屏展示内容区域 -->
    <div class="screen" ref="screen">
      <div class="top">
        <Top />
      </div>
      <div class="bottom">
        <div class="left">
          <Tourist class="tourist" />
          <Sex class="sex" />
          <Age class="age" />
        </div>
        <div class="center">
          <Map class="map" />

          <Line class="line" />
        </div>
        <div class="right">
          <Rank class="rank"/>

          <Year class="year"/>

          <Couter class="couter"/>



        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref, onMounted } from "vue";
//引入顶部的展示区组件
import Top from './components/top/index.vue';

import Tourist from './components/tourist/index.vue';

import Sex from './components/sex/index.vue';

import Age from './components/age/index.vue';

import Map from './components/map/index.vue';

import Line from './components/line/index.vue';

import Couter from './components/couter/index.vue';

import Year from './components/year/index.vue';

import Rank from './components/rank/index.vue';





let screen = ref();

onMounted(() => {
  screen.value.style.transform = `scale(${getScale()}) translate(-50%,-50%)`
});

function getScale(w = 1920, h = 1080) {
  const ww = window.innerWidth / w;
  const hh = window.innerHeight / h;
  return ww < hh ? ww : hh;
}
window.onresize = () => {
  screen.value.style.transform = `scale(${getScale()}) translate(-50%,-50%)`
};
</script>

<style scoped lang="scss">
.containers {
  width: 100vw;
  height: 100vh;
  background: url(./images/bg.png) no-repeat;
  background-size: cover;

  .screen {
    position: fixed;
    width: 1920px;
    height: 1080px;
    left: 50%;
    top: 50%;
    transform-origin: left top;

    .top {
      width: 100%;
      height: 37.5px;
    }

    .bottom {
      display: flex;

      .left {
        margin-left: 2.5%;
        flex: 0.8;
        height: 1040px;
        display: flex;
        flex-direction: column;

        .tourist {
          margin-top: 15px;
          flex: 1.2;

        }

        .sex {
          margin: 10px 0px;

          flex: 1;

        }

        .age {
          margin: 10px 0px;
          flex: 1;
        }

      }

      .center {
        flex: 2;
        display: flex;
        flex-direction: column;
        margin-left: 40px;

        .map {
          flex: 4;
          margin-top: 40px;
        }

        .line {
          flex: 1;
          margin:10px 0px;
        }

      }

      .right {
        flex: 1;
        height: 1040px;
        margin-left: 2.5%;

        display: flex;
        flex-direction: column;
        .rank{
          flex: 1.2;
          margin-top: 15px;


        }
        .year{
          flex: 1;
          margin: 10px 0px;


        }
       
        .couter{
          flex: 1;
          margin: 10px 0px;
        }
      }

    }
  }
}</style>
